#include <algorithm>
#include <cstdio>
constexpr int MaxN = 7e3 + 5;
int n;
int p[MaxN];
int main()
{
    freopen("palindrome.in", "r", stdin);
    freopen("palindrome.out", "w", stdout);
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &p[i]);
    }
    std::sort(p + 1, p + 1 + n);
    int answer = 0;
    int plan = 0;
    for (;;)
    {
        int temp = n;
        for (int l = 1; l <= n; l++)
        {
            for (int r = l + 1; r <= n; r++)
            {
                bool suc = true;
                for (int k = 1; suc && k <= (r - l + 1) / 2; k++)
                {
                    suc &= p[l + k - 1] == p[r - k + 1];
                }
                if (suc)
                {
                    temp++;
                }
            }
        }
        if (temp > answer)
        {
            answer = temp;
            plan = 0;
        }
        if (temp == answer)
        {
            plan++;
        }
        if (!std::next_permutation(p + 1, p + 1 + n))
        {
            break;
        }
    }
    printf("%d %d\n", answer, plan);
    return 0;
}
